

object AnyMatch {

  //可以继续增加匹配项
  def macthOption(x:Option[Any]) : Any= x match{

    case Some(x:Int) =>x

    case Some(x:String) =>x

    case Some(x:Double) =>x

    case Some(x:Boolean) =>x

    case _ => new RuntimeException

  }


  def main(args: Array[String]): Unit = {
    println(macthOption(Some(5L)))
  }

}
